import { CanActivate, ExecutionContext, Inject, Injectable } from '@nestjs/common';
import { Reflector } from '@nestjs/core';
import { Observable } from 'rxjs';

@Injectable()
export class AaaGuard implements CanActivate {
  
  //constructor(private reflector : Reflector){}
  @Inject(Reflector)
  private reflector: Reflector;

  canActivate(
    context: ExecutionContext,  //继承自-ArgumentsHost
  ): boolean | Promise<boolean> | Observable<boolean> {
 
    //使用 reflector 来取 metadata
    console.log(this.reflector.get('aaa',context.getHandler()));
    return true;
  }



}
